﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TinTuc_Entry.ascx.cs" Inherits="cbmobile.UserControl.TinTuc_Entry" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>
<script type="text/javascript">

    var activeArea = null;
    var winW = 0;
    var winH = 0;
    var clickX = 0;
    var clickY = 0;
    function GetWindowSize() {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            winH = document.body.clientHeight;
            winW = document.body.clientWidth;
        } else {
            winH = window.innerHeight;
            winW = window.innerWidth;
        }
    }
    function GetMouseXY(e) {
        if (navigator.appName.indexOf("Microsoft") != -1) { // grab the x-y pos.s if browser is IE
            clickX = e.clientX + document.body.scrollLeft
            clickY = e.clientY + document.body.scrollTop
        } else {  // grab the x-y pos.s if browser is NS
            clickX = e.pageX
            clickY = e.pageY
        }
        // catch possible negative values in NS4
        if (clickX < 0) clickX = 0;
        if (clickY < 0) clickY = 0;
        return true
    }

    function AreaContains(parent, child) {
        while (child)
            if (parent == child) return true;
            else
                child = child.parentNode;

        return false;
    }
    function PopupAreaMouseOut(e) {
        if (!e)
            var e = window.event;
        var targ = e.relatedTarget ? e.relatedTarget : e.toElement;
        if (activeArea != null && !AreaContains(activeArea, targ)) {
            activeArea.style.display = 'none';
            activeArea = null;
        }
    }

    function PopupArea(e) {
        // get viewing size 
        GetWindowSize();
        GetMouseXY(e);

        // hide the old area
        if (activeArea != null) {
            activeArea.style.display = 'none';
        }

        // pop-up area
        var popupArea = document.getElementById("divImageProduct");
        popupArea.style.position = 'absolute';
        popupArea.style.display = 'inline';
        popupArea.style.zIndex = "9999";
        popupArea.style.top = clickY - 78 + 'px';
        popupArea.style.left = clickX + 10 + 'px';

        popupArea.onmouseout = PopupAreaMouseOut;
        document.body.appendChild(popupArea);

        // keep the pop-up area
        activeArea = popupArea;
    }

    function ShowImage(event, isShow) {

        if (isShow == 0) {
            document.getElementById("divImageProduct").style.display = 'none';
            return false;
        } else {
            PopupArea(event);
            return false;
        }

    }

    function CheckValidate() {
        var check = false;
        var objArrFile = document.getElementsByTagName('input');
        for (i = 0; i < objArrFile.length; i++) {
            if (objArrFile[i].type == 'text') {
                if (objArrFile[i].id.toString().indexOf('txtName') >= 0 && objArrFile[i].value != '')
                    check = true;
            }
        }
        if (!check) {
            alert('Nhập tiêu đề');
            return false;
        }
        return true;
    }

</script>

<div class="sb-box">
    <div class="header">
        <h3>
            Cập nhật bài viết</h3>
        <asp:LinkButton ID="btnList" runat="server" Text="Về danh sách" 
            CssClass="button small" onclick="btnList_Click">
            <span>Về danh sách</span>
        </asp:LinkButton>
        &nbsp;
        <asp:LinkButton ID="btnSave" runat="server" Text="Lưu" CssClass="button small"  onclick="btnSave_Click">
            
            <span>Lưu</span>
        </asp:LinkButton>
        &nbsp;
        
    </div>
    <div class=" clear">
    </div>
    <div class="bcont">
        <div class="selection">
            <asp:HiddenField ID="hdnReleatedNews" Value="" runat="server" />
            <asp:HiddenField ID="hdnCategoryIDs" Value="" runat="server" />
            <asp:LinkButton ID="btnRefesh" runat="server" Style="display: none;"></asp:LinkButton>
            <asp:HiddenField ID="hidSelectedTab" Value="2" runat="server" />
            <div id="divData">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <%--<asp:Repeater ID="rptText" runat="server">
                        <ItemTemplate>--%>
                            <tr>
                                <th class="RB_L" width="15%">
                                    <asp:Label ID="lblTieuDe" Text="Tiêu đề" runat="server" />
                                </th>
                                <td class="B_L" colspan="3">
                                    <asp:TextBox ID="txtTieuDe" CssClass="inputtext" runat="server" width="95%" TextMode="SingleLine" />
                                </td>
                            </tr>
                       <%-- </ItemTemplate>
                    </asp:Repeater>--%>
                    <tr>
                        <th class="RB_L">
                            <asp:Label ID="lblTrangThai" runat="server" Text="Trạng thái" Font-Bold="true"></asp:Label>
                        </th>
                        <td class="B_L">
                            <asp:DropDownList ID="ddlNewsStatus" runat="server" Width="150px" CssClass="select">
                                <asp:ListItem Value="0">Disable</asp:ListItem>
                                <asp:ListItem Value="1" Selected="True">Enable</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <%--<asp:Repeater ID="Repeater1" runat="server">
                        <ItemTemplate>--%>
                            <tr>
                                <th class="RB_L" width="15%">
                                    <asp:Label ID="lblMoTa" Text="Mô tả ngắn" runat="server" />
                                </th>
                                <td class="B_L" colspan="3">
                                    <asp:TextBox ID="txtMoTa" CssClass="inputtext" runat="server" width="95%" TextMode="MultiLine" />
                                </td>
                            </tr>
                        <%--</ItemTemplate>
                    </asp:Repeater>
                    <asp:Repeater ID="Repeater2" runat="server">
                        <ItemTemplate>--%>
                            <tr>
                                <th class="RB_L" width='15%'>
                                    <asp:Label ID="lblNoiDung" Text="Nội dung" runat="server" />
                                </th>
                                <td class="B_L" colspan="3">
                                    <FCKeditorV2:FCKeditor ID="fckmlDescription" runat="server"  Width="95%" Height="300px"
                                                    BasePath="~/fckeditor/">
                                    </FCKeditorV2:FCKeditor> 
                                </td>
                            </tr>
                        <%--</ItemTemplate>
                    </asp:Repeater>--%>
                            <tr>
                                <th class="RB_L" width="15%">
                                    <asp:Label ID="lblNgayNhap" Text="Ngày nhập" runat="server" />
                                </th>
                                <td class="B_L" colspan="3">
                                    <asp:TextBox ID="txtNgayNhap" runat="server" CssClass="inputtext" width="15%" TextMode="SingleLine" />
                                    <asp:ImageButton ID="ImageButton1" runat="server" 
                                        ImageUrl="~/images/1288165338_alarm.png" onclick="ImageButton1_Click" />
                                    <asp:Calendar ID="Calendar1" runat="server" Visible="False" 
                                        onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar>
                                </td>
                            </tr>
                </table>
            </div>
        </div>
    </div>
</div>


